﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
//using System.Web.DynamicData;
using OA.Model;
using OA.Model.MyAttribute;
using OA.Core;
using System;


namespace OA.Model
{
    //[TableName("权限组")]
    [Table("PermissionGroup")]
    public class PermissionGroup : BaseInfo
    {
        public int Status { get; set; }

        [DisplayName("名称")]
        [MaxLength(20)]         
        [Tag(TagEnum.Text, "required", "名称", 3, 20)]
        public string Name { get; set; }

        /// <summary>
        /// 权限，多个权限用,隔开
        /// </summary>
        [DisplayName("权限")]
        public string PermissionContext { get; set; }

    }

    public class SimplePermissionGroup : SimpleInfo
    {
        public string Name { get; set; }

        public DateTime CreateDateTime { get; set; }

        [NotMapped]
        public bool IsSelected { get; set; }

        public static Expression<Func<PermissionGroup, SimplePermissionGroup>> Map = m => new SimplePermissionGroup()
        {
            ID = m.ID,
            Name = m.Name,
            CreateDateTime = m.CreateDateTime,
            Status = m.Status
        };
    }


    //[TableName("用户权限")]
    [Table("UserPermissionGroup")]
    public class UserPermissionGroup:BaseInfo
    {
        public int Status { get; set; }

        public string EmpID { get; set; }

        public int PermissionGroupID { get; set; }
    }
}
